//
//  TabBarController.m
//  rssreader
//
//  Created by Zzz on 15/11/29.
//  Copyright © 2015年 Zzz. All rights reserved.
//

#import "BaseTabBar.h"
#import "BaseNav.h"
#import "IconFont.h"
#import "NavStatus.h"

#import "FindViewController.h"
#import "ContactsViewController.h"
#import "MyViewController.h"
#import "BrushFaceVC.h"
#import "BrushStaticClass.h"
//#import "SquareScene.h"
//#import "MineScene.h"
//#import "ChannelScene.h"
//#import "TopicScene.h"


@interface BaseTabBar ()<UITabBarControllerDelegate>
@property(nonatomic,retain)BaseNav *brushFaceNav;
@property(nonatomic,retain)BaseNav *friendNav;
@property(nonatomic,retain)BaseNav *findNav;
@property(nonatomic,retain)BaseNav *meNav;
@end

@implementation BaseTabBar

- (void)viewDidLoad {
    [super viewDidLoad];
    self.tabBar.translucent= NO;

    _brushFaceNav = [[BaseNav alloc]initWithRootViewController:
                           [[BrushFaceVC alloc]init]];
    
    _friendNav = [[BaseNav alloc]initWithRootViewController:
                               [[ContactsViewController alloc]init]];

    _findNav = [[BaseNav alloc]initWithRootViewController:
                        [[FindViewController alloc] init]];

    _meNav = [[BaseNav alloc]initWithRootViewController:
                          [[MyViewController alloc]init]];
    self.viewControllers = @[_brushFaceNav,_friendNav,_findNav,_meNav];
    
    UIImage * taitem1SelectImage = [[UIImage imageNamed:@"tabBarIte0_default.png"]  imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    [_brushFaceNav.tabBarItem setSelectedImage: taitem1SelectImage];
    [_brushFaceNav.tabBarItem setImage:[UIImage imageNamed:@"tabBarIte0_select.png"]];
    _brushFaceNav.tabBarItem.title = @"刷脸";
    
    
    UIImage * taitem2SelectImage = [[UIImage imageNamed:@"tabBarIte1_default@2x.png"]  imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    [_friendNav.tabBarItem setSelectedImage:
     taitem2SelectImage];
    [_friendNav.tabBarItem setImage:[UIImage imageNamed:@"tabBarIte1_select@2x.png"]];
    _friendNav.tabBarItem.title = @"通讯录";
    
    
    UIImage * taitem3SelectImage = [[UIImage imageNamed:@"tabBarIte2_default@2x.png"]  imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    [_findNav.tabBarItem setSelectedImage:
     taitem3SelectImage];
    [_findNav.tabBarItem setImage:[UIImage imageNamed:@"tabBarIte2_select@2x.png"]];
     _findNav.tabBarItem.title = @"发现";
    
    UIImage * taitem4SelectImage = [[UIImage imageNamed:@"tabBarIte3_default@2x.png"]  imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    [_meNav.tabBarItem setSelectedImage:
     taitem4SelectImage];
    [_meNav.tabBarItem setImage:[UIImage imageNamed:@"tabBarIte3_select@2x.png"]];
     _meNav.tabBarItem.title = @"我的";
    self.delegate = self;
    self.tabBar.tintColor = UIColorFromRGB(0x3ec6ff);
}
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController {
    
    if ([BrushStaticClass isNeedLogin:YES]) {
        return NO;
    }else{
        return YES;
    }
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}
- (BOOL)shouldAutorotate{
    return NO;
}

@end
